<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<div th:insert="/common.html"></div>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/js/jquery-2.1.1.min.js"></script>
    <script type="text/javascript">
        function deng() {
            $.ajax({
                url:"/person/getinfo",
                type:"post",
                dataType:"json",
                data:$("#userId").serialize(),
                success:function (data) {
                    if (data != null){
                        alert("登陆成功")
                        location.href = "/menu/toshow"
                    }else {
                        alert("还没有账号?请注册吧")
                        location.href = "/user/toList"
                    }
                },
                error:function (data) {
                    alert("XXXXX")
                }
            })
        }
    </script>
</head>
<body>
<div class="container-fluid">
    <div class="panel panel-primary" style="width:400px">
        <div class="panel-heading">
            <h1>登录</h1>
        </div>
        <div class="panel-body">
            <form id="userId">
                <div class="form-group">
                    <label for="name">账号</label>
                    <input type="text" class="form-control" name="pname" id="name"
                           placeholder="请输入账号">
                    <div id="tips"></div>
                </div>
                <div class="form-group">
                    <label for="pwd">密码</label>
                    <input type="password" class="form-control" name="pwd" id="pwd">
                </div>
                <input type="button" class="btn btn-success btn-lg" value="登录" onclick="deng()">
<!--                <a class="btn btn-danger" href="/user/toList">注册</a><br>-->
            </form>
        </div>
        <div class="panel-footer">
            <a href="#">忘记密码？</a>
        </div>
    </div>
</div>
</body>
</html>